﻿<html>

<head>
    <title>装箱-精工云MES系统移动端</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link href="/JG/Content/jquery/weui/style/weui.min.css" rel="stylesheet" />
    <link href="/JG/Content/jquery/jquery-weui/css/jquery-weui.min.css" rel="stylesheet" />
    <link href="/JG/Content/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/JG/Content/css/Global.css" rel="stylesheet" />
    <link rel="stylesheet" href="/JG/Content/css/PackingList.css?v=1">
    <link rel="stylesheet" href="/JG/Content/css/TabletsGlobal.css?v=1">
    <script src="/JG/Content/LocalConfigs.js"></script>
    <script src="/JG/Content/LocalUserInfo.js"></script>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body ontouchstart>
    <!--title部分-->
    <header class="header">
        <div class="empty">
            <span id="stations"></span>
        </div>
        <div class="header_title">
            <a href="javascript:;">装箱</a>
        </div>
        <div class="item item2">
            <div class="set">
                <!--<span class="glyphicon glyphicon-cog" style="font-size: 50px;color:#FFFFFF"></span>-->
                <span><img style="width:50px" src="/JG/Content/images/early.png" alt=""></span>
            </div>
            <div class="user_img" onclick="javascript:location.href='/JG/Home/Index.html'">
                <span class="back"><img src="/JG/Content/images/return.png" alt=""></span>
            </div>
            <div class="clean"></div>
        </div>
    </header>

    <div id="MainPage" class="MainPage" v-cloak>
        <div class="input-group" style="text-align:center;font-size:18px;">
            <label class="input-group-addon" for="BarCode">SN码</label>
            <input type="text" class="form-control" maxlength="50" v-model="BarCode" placeholder="扫描或输入SN码回车"
                id="BarCode" :disabled="IsDisable" />
        </div>
        <div id="tab2" class="weui-tab__bd-item">
            <div class="left">
                <ul class="list-group">
                    <!-- <li class="list-group-item" v-if="CurrProcessName">当前工序&nbsp;&nbsp;{{CurrProcessName}}</li> -->
                    <li class="list-group-item">当前SN码&nbsp;&nbsp;{{CurrBarCode}}
                    </li>
                    <li class="list-group-item">
                        任务单号&nbsp;&nbsp;{{FormData.TaskCode}}
                    </li>
                    <!-- <li class="list-group-item">
                        产品码&nbsp; &nbsp;{{FormData.InvBarCode}}
                    </li> -->
                    <!-- <li class="list-group-item">
                        产品编码&nbsp; &nbsp;{{FormData.InvCode}}
                    </li> -->
                    <li class="list-group-item">
                        产品名称&nbsp; &nbsp;{{FormData.InvName}} &nbsp; &nbsp;{{FormData.InvCode}}
                    </li>
                    <li class="list-group-item">
                        产品型号&nbsp; &nbsp;{{FormData.InvStd}}
                    </li>
                    <li class="list-group-item">
                        订单号码/内部订单号&nbsp;&nbsp;{{FormData.OrderCode}}/{{FormData.ProcessCode}}
                    </li>
                    <!-- <li class="list-group-item">
                        流程卡号&nbsp; &nbsp;{{FormData.ProcessCode}}
                    </li> -->
                    <li class="list-group-item">
                        <!-- 任务数量&nbsp;&nbsp;{{FormData.TaskQty}} -->
                        订单数量/任务数量&nbsp;&nbsp;{{FormData.OrderNum}}/{{FormData.TaskQty}}
                    </li>
                    <li class="list-group-item">
                        <!-- 投入数量&nbsp;&nbsp;{{FormData.InputQty}} -->
                        投入数量/已扫数量&nbsp;&nbsp;{{FormData.InputQty}}/{{ScanCodeNum}}
                    </li>
                    <!-- <li class="list-group-item">
                        已扫数量&nbsp;&nbsp;{{ScanCodeNum}}
                    </li> -->
                    <li class="list-group-item">
                        装箱数量/已装数量&nbsp;&nbsp;{{FormData.InnerBoxQty}}/{{CurrInnerBoxQty}}
                    </li>
                    <!-- <li class="list-group-item">
                        已装数量&nbsp;&nbsp;{{CurrInnerBoxQty}}
                    </li> -->
                </ul>
            </div>

            <div class="right panel panel-default">
                <ul class="nav nav-tabs">
                    <li class="active">
                        <a href="#OperateRecord" data-toggle="tab">操作记录</a>
                    </li>
                    <li>
                        <a href="#Swiper" data-toggle="tab">操作指导</a>
                    </li>
                </ul>
                <div class="tab-content tabs">
                    <div class="tab-pane fade in active" id="OperateRecord">
                        <ul style="height:100%;overflow-y:auto;">
                            <li style="font-size: 1.2em" v-for="(item,index) in OperateRecord"
                                :style="{'color':item.Status?'blue':'red'}">
                                {{item.Content}}
                            </li>
                        </ul>
                    </div>
                    <div class="tab-pane fade" id="Swiper">
                        <div class="swiper-container">
                            <div class="swiper-wrapper" id="Top_Swiper">
                            </div>
                            <div class="swiper-pagination"></div>
                        </div>
                    </div>
                </div>
            </div>

            <!--弹窗部分-->
            <div class="dialog">
                <span><img src="/JG/Content/images/timg.jpg" alt="关闭"></span>
                <div class="dialog_img"><img src="" id="ShowImg" alt=""></div>
            </div>
        </div>

        <div class="panel panel-default">
            <div class="panel-heading">
                装箱产品明细
            </div>
            <table class="table" style="text-align:center">
                <thead>
                    <tr>
                        <th style="text-align:center">外箱条码</th>
                        <th>产品条码</th>
                        <th>产品名称</th>
                        <th>型号</th>
                        <th>过站时间</th>
                        <th>操作人</th>
                    </tr>
                </thead>
                <tbody id="tbody">
                    <tr v-for="(item,index) in InnerBoxRecord">
                        <td :rowspan="item.PackingBarCodespan" :class="{hidden:item.PackingBarCodedis}">
                            {{item.PackingBarCode}}
                        </td>
                        <td>
                            {{item.BarCode}}
                        </td>
                        <td>
                            {{item.InvName}}
                        </td>
                        <td>
                            {{item.InvStd}}
                        </td>
                        <td>
                            {{item.StationTime}}
                        </td>
                        <td>
                            {{item.Operator}}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>

    <script src="/JG/Content/jquery/jquery-3.2.1.min.js"></script>
    <script src="/JG/Content/jquery/jquery-weui/js/jquery-weui.min.js"></script>
    <script src="/JG/Content/jquery/jquery-weui/js/swiper.min.js"></script>
    <script src="/JG//Content/AudioUtils.js"></script>
    <script src="/JG/Content/Common.js"></script>
    <script src="/JG//Content/Station.js"></script>
    <script src="/JG/Content/bootstrap.min.js"></script>
    <script src="/JG/Content/Utils.js?v=1"></script>
    <script src="/JG/Content/jquery/fastclick.js"></script>
    <script src="/JG/Content/bootstrap/bootbox/bootbox.min.js"></script>
    <script src="/JG/Content/bootstrap/bootbox/bootbox.locales.min.js"></script>
    <script>
        $(function () {
            FastClick.attach(document.body);
        });
        $(document).ready(function () {
            Station.Init(".header");
            var stations = LocalUserInfo.GetUserInfo();
            $("#stations").html(stations.ProductionLineName + " - " + stations.StationName);
        })
        //操作指导部分图片弹窗部分
        function popup(e) {
            //debugger;
            //弹出背景

            //关闭文字字体大小
            // $(".dialog>span").css({
            //     'position': 'absolute',
            //     'right': '.3em',
            //     'font-size':'5em',



            // })
            $("#ShowImg")[0].src = e.src;
            $(".dialog").fadeIn();

            $(".dialog>span").click(function () {
                $(".dialog").fadeOut();
            })
        }
    </script>
    <script src="/JG/Content/vue-v2.34.js"></script>
    <script type="text/javascript">
        var vmPage = new Vue({
            el: "#MainPage",
            data: {
                CurrProcessType: "GXLX008", //当前工序类型
                CurrProcessCode: "",  //当前工序编码
                CurrProcessName: "",  //当前工序名称
                CurrProcessIndex: 0,   //当前工序顺序
                ScanCodeNum: 0,        //扫码数量
                BarCodeNum: "1",        //打印数量
                CurrBarCode: "",       //当前条码
                CurrInnerBoxQty: 0,    //已装数量
                BarCode: "",
                IsDisable: false,
                FormData: {
                    ScheduleID: "", //排产ID
                    TaskCode: "",   //任务号
                    TaskQty: "",    //任务数量
                    InputQty: 0, //投入数量
                    InnerBoxQty: 0, //内箱数量
                    InvCode: "",
                    InvName: "",
                    InvStd: "",
                    LineCode: "",
                    LineName: "",
                    InvBarCode: "",
                    InvProcessType: "", //产品工序类型
                    OrderCode: "",//订单号码
                    OrderNum: "",//订单数量
                    ProcessCode: "",//流程卡号
                    MaxOperatingRecordNum: ""//操作记录显示最大条数
                },
                StationRecord: [],
                InnerBoxRecord: [],
                OperateRecord: []
            },
            mounted: function () {
                var currSelf = this;
                $("#BarCode").bind("keypress", currSelf.SearchBarCode);
                $("#BarCode").focus();
                Utils.AutoBarCodeFocus();
                var data = MaxOperatingRecord();
                if (data.IsSuccess && data.Data) {
                    currSelf.MaxOperatingRecordNum = data.Data;
                }

                $.showLoading();
                $.ajax({
                    type: "post",
                    url: LocalConfig.SrvPath + "/jgmes/commonAction!getCurrentProductByCxCp.action",
                    data: { userCode: LocalUserInfo.GetUserInfo().UserCode, mac: LocalUserInfo.GetUserInfo().Mac, cxCode: LocalUserInfo.GetUserInfo().ProductionLineCode },
                    dataType: "json",
                    success: function (ret) {
                        var retData = ReturnData(ret);
                        if (retData.IsSuccess && ret.Data) {
                            currSelf.SetBaseData(retData);
                            //获取当前已扫码数量
                            var NumData = GetCountScan(currSelf.FormData.ScheduleID);
                            if (NumData.IsSuccess && NumData.Data) {
                                currSelf.ScanCodeNum = NumData.Data;
                            }
                        } else currSelf.SetOperateRecord(retData.message, false);
                    }, error: function (xhr, status, errorThrown) {
                        console.error(status);
                        $.alert("请求失败");
                    }, complete: function () {
                        $.hideLoading();
                    }
                });
            },
            methods: {
                InitData: function (barCode) {
                    var currSelf = this;
                    $.showLoading();
                    $.ajax({
                        type: "post",
                        url: LocalConfig.SrvPath + "/jgmes/commonAction!getCurrentProductByCxCp.action",
                        data: {
                            userCode: LocalUserInfo.GetUserInfo().UserCode, mac: LocalUserInfo.GetUserInfo().Mac,
                            cxCode: LocalUserInfo.GetUserInfo().ProductionLineCode,
                            barCode: barCode,
                        },
                        dataType: "json",
                        success: function (ret) {
                            var retData = ReturnData(ret);
                            if (retData.IsSuccess && ret.Data) {
                                currSelf.SetBaseData(retData);
                            } else currSelf.SetOperateRecord(retData.message, false);
                        }, error: function (xhr, status, errorThrown) {
                            console.error(status);
                            $.alert("请求失败");
                        }, complete: function () {
                            $.hideLoading();
                        }
                    });
                },
                SetOperateRecord: function (content, status) {
                    var currSelf = this;
                    var content = (new Date().Format("hh:mm:sss")) + ' ' + content;
                    currSelf.OperateRecord.splice(0, 0, { Content: content, Status: status });
                    if (currSelf.OperateRecord.length > currSelf.MaxOperatingRecordNum) {
                        currSelf.OperateRecord.splice(currSelf.MaxOperatingRecordNum)
                    }
                },
                SetInputQuantity: function (err, data) {
                    var currSelf = this;
                    if (!err && data && data.IsSuccess) {
                        currSelf.FormData.InputQty = data.Data;
                    }
                },
                SetBaseData: function (retData) {
                    var currSelf = this;

                    currSelf.FormData.ScheduleID = retData.Data.JGMES_PLAN_SCRW_ID;
                    currSelf.FormData.TaskCode = retData.Data.SCRW_RWDH;
                    currSelf.FormData.InvCode = retData.Data.SCRW_CPBH;
                    currSelf.FormData.InvName = retData.Data.SCRW_NAME;
                    currSelf.FormData.InvStd = retData.Data.SCRW_CPGG;
                    currSelf.FormData.LineCode = retData.Data.SCRW_CXBM;
                    // currSelf.FormData.LineCode = retData.Data.SCRW_CXMC;
                    currSelf.FormData.TaskQty = retData.Data.SCRW_PCSL;
                    currSelf.FormData.OrderCode = retData.Data.SCRW_DDHM;
                    currSelf.FormData.OrderNum = retData.Data.SCRW_DDSL;
                    currSelf.FormData.ProcessCode = retData.Data.SCRW_LCKH;

                    var printData = GetProductPrintParam(currSelf.FormData.InvCode);
                    if (printData && printData.IsSuccess && printData.Data) {
                        currSelf.FormData.InnerBoxQty = printData.Data.CPTMYYGG_MTMSL;
                    } else {
                        var content = "未能找到当前产品打印参数"
                        currSelf.SetOperateRecord(content, false);
                        $.toptip(content, Utils.ToptipWaitTime.Error, "error");
                    }

                    //获取当前用户当前产品的工序
                    var data = GetCurrentProcess(currSelf.FormData.InvCode);
                    // //获取当前已扫码数量
                    // var NumData = GetCountScan(currSelf.FormData.ScheduleID);
                    // if (NumData.IsSuccess && NumData.Data) {
                    //     currSelf.ScanCodeNum = NumData.Data;
                    // }

                    if (data.IsSuccess && data.Data) {
                        currSelf.FormData.InvProcessType = data.Data.GXGL_GXLX_NAME;
                        currSelf.CurrProcessCode = data.Data.GXGL_GXNUM;
                        currSelf.CurrProcessName = data.Data.GXGL_GXNAME;

                        currSelf.CurrProcessIndex = data.Data.GXGL_GXSXH;  //首工位为1,大于1显示投入数量
                        if (Utils.TabletsGlobalParam.IsOpenInputQtyTask) {
                            GetInputQuantity(currSelf.FormData.InvCode, currSelf.FormData.ScheduleID, currSelf.SetInputQuantity);

                            var ret1 = setInterval(function () {
                                GetInputQuantity(currSelf.FormData.InvCode, currSelf.FormData.ScheduleID, currSelf.SetInputQuantity);
                            }, Utils.TabletsGlobalParam.InputQtyTaskFrequency);
                        }

                        if (data.Data.GXGL_SOP && data.Data.GXGL_SOP.length > 0) {
                            var htmlAppend = "";
                            var imgSOPs = JSON.parse(data.Data.GXGL_SOP);
                            for (var index in imgSOPs) {
                                var item = imgSOPs[index];
                                htmlAppend += "<div class='swiper-slide'><img onclick='popup(this)' style='width:100%;height:100%' src='" + LocalConfig.SrvPath + item.path + "'/></div>";
                            }
                            $("#Top_Swiper").append(htmlAppend);
                            //3.11 自动轮播
                            var index = 0;
                            /*当鼠标放到顺序按钮上时：
                            1.将当前这个顺序按钮增加样式为红色背景
                            2.移除周围其他同级元素红色背景样式
                            3.获取当前顺序按钮的index
                            4.通过index获取该位置图片
                            5.一秒钟渐入该图片
                            6.一秒钟渐出其他相邻图片
                            7.防止移动过快导致的效果闪现，使用stop方法
                            */
                            $("#Swiper div>span").mousemove(function () {
                                $(this).addClass("swiper-pagination-bullet-active").siblings().removeClass("swiper-pagination-bullet-active");
                                index = $(this).index();
                                $("#Top_Swiper div").eq(index).stop().fadeIn(1000).siblings().stop().fadeOut(0);
                            });
                            var len = $('#Top_Swiper div').length;
                            var time = setInterval(move, 3000);

                            function move() {
                                index++;
                                if (index == len) {
                                    index = 0;
                                }
                                $('#Swiper div>span').eq(index).addClass("swiper-pagination-bullet-active").siblings().removeClass("swiper-pagination-bullet-active");
                                $('#Top_Swiper div').eq(index).stop().fadeIn(1000).siblings().stop().fadeOut(0);
                            }

                            /*当鼠标划入、划出轮播图区域时：
                            1.划入时停止自动轮播
                            2.划出时继续自动轮播
                            */
                            $("#Swiper").hover(function () {
                                clearInterval(time);
                            },
                                function () {
                                    time = setInterval(move, 3000);
                                });
                            if (imgSOPs && imgSOPs.length > 1) {
                                $(".swiper-container").swiper({
                                    loop: true,
                                    autoplay: 3000
                                });
                            }
                        }
                    }
                },
                SearchBarCode: function (event) {
                    var currSelf = this;
                    if (event.which == 13) {
                        currSelf.CurrBarCode = currSelf.BarCode;
                        currSelf.BarCode = "";
                        var showMsg;

                        currSelf.IsDisable = true;
                        if (!currSelf.FormData.InvCode) {
                            showMsg = '当前产线无产品在生产中';
                            $.toptip(showMsg, Utils.ToptipWaitTime.Warning, "warning");
                            currSelf.SetOperateRecord(showMsg, false);
                            AudioUtils.Play(AudioUtils.ScanCodeFail);
                        } else if (currSelf.CurrProcessType != currSelf.FormData.InvProcessType) {
                            showMsg = '工序类型不匹配不能过站,请核对!';
                            $.toptip(showMsg, Utils.ToptipWaitTime.Warning, "warning");
                            currSelf.SetOperateRecord(showMsg, false);
                            AudioUtils.Play(AudioUtils.ScanCodeFail);
                        } else if (!currSelf.CurrBarCode || currSelf.CurrBarCode.length <= 0) {
                            showMsg = 'SN码不能为空';
                            $.toptip(showMsg, Utils.ToptipWaitTime.Warning, "warning");
                            currSelf.SetOperateRecord(showMsg, false);
                            AudioUtils.Play(AudioUtils.ScanCodeFail);
                        } else {

                            var IsCheckBarCode = CheckProductBarCode(currSelf.FormData.InvCode, currSelf.CurrBarCode, currSelf.FormData.ScheduleID);
                            if (IsCheckBarCode && IsCheckBarCode.IsSuccess) { //通过
                                currSelf.SetOperateRecord(currSelf.CurrBarCode + ",扫码成功！", true);
                                AudioUtils.Play(AudioUtils.ScanCodeSuccess);
                                currSelf.CurrInnerBoxQty++;

                                var record = { BarCode: currSelf.CurrBarCode, InvName: currSelf.FormData.InvName, InvStd: currSelf.FormData.InvStd, StationTime: new Date().Format("hh:mm:ss"), Operator: LocalUserInfo.GetUserInfo().UserName, PackingBarCode: "" };

                                if (currSelf.CurrInnerBoxQty == currSelf.FormData.InnerBoxQty) { //装箱数量和已装数量相等
                                    currSelf.ScanCodeNum++;
                                    currSelf.CurrInnerBoxQty = 0;
                                    $.showLoading("打印中...");
                                    currSelf.StationRecord.splice(0, 0, record);
                                    var barCodes = "";

                                    $.each(currSelf.StationRecord, function (index, element) {
                                        if (!element.PackingBarCode) {
                                            if (barCodes.length == 0)
                                                barCodes = element.BarCode;
                                            else
                                                barCodes += "," + element.BarCode;
                                        }
                                    });

                                    $.ajax({
                                        type: "post",
                                        url: LocalConfig.SrvPath + "/jgmes/commonAction!getPrintInfo.action",
                                        data: {
                                            userCode: LocalUserInfo.GetUserInfo().UserCode, mac: LocalUserInfo.GetUserInfo().Mac,
                                            cpCode: currSelf.FormData.InvCode, printQty: currSelf.BarCodeNum, barCodes: barCodes
                                        },
                                        dataType: "json",
                                        success: function (ret) {
                                            var printInfo = ReturnData(ret);
                                            if (printInfo.IsSuccess && printInfo.Data) {
                                                if (!printInfo.Data.Address || !printInfo.Data.PrintParams) {
                                                    showMsg = "打印参数信息缺失";
                                                    currSelf.SetOperateRecord(showMsg, false);
                                                    $.toptip(showMsg, Utils.ToptipWaitTime.Error, "error");
                                                } else {
                                                    currSelf.SetOperateRecord("成功获取打印参数信息!", true);
                                                    AudioUtils.Play(AudioUtils.StartPrint);
                                                    $.ajax({
                                                        type: "post",
                                                        async: false,
                                                        timeout: 1000,
                                                        url: printInfo.Data.Address,
                                                        data: printInfo.Data.PrintParams,
                                                        dataType: "json",
                                                        success: function (printStatus) {
                                                            //var printStatus=JSON.stringify(ret);
                                                            if (printStatus.IsSuccess) {

                                                                showMsg = printInfo.Data.BarCode + ",打印成功";
                                                                currSelf.SetOperateRecord(showMsg, true);
                                                                AudioUtils.Play(AudioUtils.PrintSuccess);
                                                                $.toptip(showMsg, Utils.ToptipWaitTime.Success, 'success');
                                                                var jsonStrDetail = [];
                                                                for (var i in currSelf.StationRecord) {
                                                                    var element = currSelf.StationRecord[i];
                                                                    if (!element.PackingBarCode) {
                                                                        element.PackingBarCode = printInfo.Data.BarCode;
                                                                        jsonStrDetail.push({ "BGSJZB_WLBH": element.InvCode, "BGSJZB_WLMC": element.InvName, "BGSJZB_WLGG": element.InvStd, "BGSJZB_SL": 1, "BGSJZB_TMH": element.BarCode });
                                                                    }
                                                                }
                                                                currSelf.InnerBoxRecord = currSelf.getData(currSelf.StationRecord);

                                                                $.ajax({
                                                                    type: "post",
                                                                    async: false,
                                                                    url: LocalConfig.SrvPath + "/jgmes/commonAction!doJsonSaveBGSJAll.action",
                                                                    data: { "userCode": LocalUserInfo.GetUserInfo().UserCode, "mac": LocalUserInfo.GetUserInfo().Mac, "jsonStr": JSON.stringify({ "BGSJ_TMH": printInfo.Data.BarCode, "BGSJ_CPBH": currSelf.FormData.InvCode, "BGSJ_SL": 1, "BGSJ_SCRWID": currSelf.FormData.ScheduleID, "BGSJ_PDJG_CODE": "PDJG01" }), "jsonStrDetail": JSON.stringify(jsonStrDetail) },
                                                                    dataType: "json",
                                                                    success: function (ret) {
                                                                        var retData = ReturnData(ret);
                                                                        if (retData.IsSuccess) {
                                                                            showMsg = printInfo.Data.BarCode + ",报工成功";
                                                                            currSelf.SetOperateRecord(showMsg, true);
                                                                            $.toptip(showMsg, Utils.ToptipWaitTime.Success, 'success');
                                                                        } else {
                                                                            showMsg = printInfo.Data.BarCode + ",报工失败";
                                                                            currSelf.SetOperateRecord(showMsg, false);
                                                                            $.toptip(showMsg, Utils.ToptipWaitTime.Error, 'error');
                                                                        }
                                                                    }, error: function (xhr, textStatus, errorThrown) {
                                                                        console.error(textStatus);
                                                                        $.alert("报工过程发生异常!");
                                                                    }
                                                                });
                                                            } else {
                                                                AudioUtils.Play(AudioUtils.PrintFail);
                                                                currSelf.SetOperateRecord(printInfo.Data.BarCode + ",打印失败!", false);
                                                            }
                                                        }, error: function (xhr, status, err) {
                                                            console.error(status);
                                                            showMsg = "打印失败!,失败原因:打印服务不在线";
                                                            currSelf.SetOperateRecord(showMsg, false);
                                                            $.alert(showMsg);
                                                        }, complete: function (xhr, status) {
                                                            $.hideLoading();
                                                        }
                                                    });
                                                }
                                            }
                                        }, error: function (xhr, status, err) {
                                            console.error(status);
                                            $.alert("请求失败");
                                        }
                                    });
                                } else {

                                    currSelf.StationRecord.splice(0, 0, record);
                                    currSelf.InnerBoxRecord = currSelf.getData(currSelf.StationRecord);
                                }
                            } else { //不通过
                                currSelf.SetOperateRecord(currSelf.CurrBarCode + ',扫码失败!' + IsCheckBarCode.message, false);
                                AudioUtils.Play(AudioUtils.ScanCodeFail);
                                // if (IsCheckBarCode.ErrorCode == 10199) {
                                //     currSelf.SetOperateRecord("生产线已经更换产品{" + currSelf.FormData.InvName + "},请重新扫码", false);
                                //     currSelf.SetBaseData(IsCheckBarCode.Data);
                                // }
                                if (IsCheckBarCode.ErrorCode == 10199) { //换产
                                    currSelf.SetOperateRecord("生产线任务单{" + currSelf.FormData.TaskCode + "}已经更换,请重新扫码", false);
                                    currSelf.InitData(currSelf.CurrBarCode);
                                    // bootbox.confirm({
                                    //     message: "是否进行换产？", buttons: {
                                    //         confirm: {
                                    //             label: '是',
                                    //             className: 'btn-success'
                                    //         },
                                    //         cancel: {
                                    //             label: '否',
                                    //             className: 'btn-danger'
                                    //         }
                                    //     }, callback: function (result) {
                                    //         if (result) {

                                    //             currSelf.InitData(currSelf.CurrBarCode);
                                    //         }
                                    //     }
                                    // });

                                }
                            }
                        }
                        currSelf.IsDisable = false;
                    }
                },
                getData: function (list) { //处理跨行
                    for (var field in list[0]) {
                        var k = 0;
                        while (k < list.length) {
                            list[k][field + 'span'] = 1;
                            list[k][field + 'dis'] = false;
                            for (var i = k + 1; i <= list.length - 1; i++) {
                                if (list[k][field] == list[i][field]) {//&& list[k][field] != ''
                                    list[k][field + 'span']++;
                                    list[k][field + 'dis'] = false;
                                    list[i][field + 'span'] = 1;
                                    list[i][field + 'dis'] = true;
                                } else {
                                    break;
                                }
                            }
                            k = i;
                        }
                    }
                    return list;
                },
            },
        });
    </script>
</body>

</html>